package com.aia.ilp.web.json;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.SessionAware;
import org.springframework.util.StringUtils;

import com.aia.ilp.domain.Cust;
import com.aia.ilp.service.MainService;
import com.cfh.util.Tools;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class CustomerGetQuestionJson extends ActionSupport implements ModelDriven<Cust>, SessionAware {
	/**
	 * Logger for this class
	 */
	private static final Logger logger = Logger.getLogger(CustomerGetQuestionJson.class);

	private Cust custToReg = new Cust();
	private Map session;
	private Map root = new HashMap();
	private String REG_IMAGE_CODE;
	private MainService mainService;
	public void validate() {
		if (custToReg == null || !StringUtils.hasText(custToReg.getCUST_MAIL())) {
			this.addActionError("参数错误");
			return;
		}

	}

	/***
	 * nouse
	 */
	public String execute() {
		if (logger.isDebugEnabled()) {
			logger.debug("execute() - start"); //$NON-NLS-1$
		}

		mainService.customerGetQuestion(this);

		String returnString = Tools.smartReturn(this);
		if (logger.isDebugEnabled()) {
			logger.debug("execute() - end"); //$NON-NLS-1$
		}

		return returnString;
	}

	public Cust getModel() {
		return custToReg;
	}

	public void setCustToReg(Cust custToReg) {
		this.custToReg = custToReg;
	}

	public Cust getCustToReg() {
		return custToReg;
	}

	public void setSession(Map session) {
		this.session = session;
	}

	public Map getSession() {
		return session;
	}

	public void setRoot(Map root) {
		this.root = root;
	}

	public Map getRoot() {
		return root;
	}

	public void setREG_IMAGE_CODE(String rEG_IMAGE_CODE) {
		REG_IMAGE_CODE = rEG_IMAGE_CODE;
	}

	public String getREG_IMAGE_CODE() {
		return REG_IMAGE_CODE;
	}

	public void setMainService(MainService mainService) {
		this.mainService = mainService;
	}

	public MainService getMainService() {
		return mainService;
	}

}
